using System;
using Newtonsoft.Json;

namespace FBGraph.Models
{
    /// <summary>An individual video</summary>
    /// <remarks>
    /// <para>Example: https://graph.facebook.com/614004947048 (A tech talk on Tornado)</para>
    /// </remarks>
    public partial class Video : IFBGraphResult
    {
        /// <summary>The video ID</summary>
        [JsonPropertyAttribute("id")]
        public Int64 Id { get; set; }
        
        /// <summary>An object containing the name and ID of the user who posted the video</summary>
        [JsonPropertyAttribute("from")]
        public From From { get; set; }
        
        /// <summary>A <see cref="PagedResult{VideoTag}" /> collection of tags identifying profiles in the video</summary>
        [JsonPropertyAttribute("tags")]
        public PagedResult<VideoTag> Tags { get; set; }
        
        /// <summary>The name of the video</summary>
        [JsonPropertyAttribute("name")]
        public String Name { get; set; }
        
        /// <summary>The URL of a picture representing the video</summary>
        [JsonPropertyAttribute("picture")]
        public String Picture { get; set; }
        
        /// <summary>An HTML snippet that can be used to embed the video in a web page</summary>
        [JsonPropertyAttribute("embed_html")]
        public String EmbedHtml { get; set; }
        
        /// <summary>An icon representing the type of the post</summary>
        [JsonPropertyAttribute("icon")]
        public String Icon { get; set; }
        
        /// <summary>The time the video was initially published</summary>
        [JsonPropertyAttribute("created_time")]
        public DateTime CreatedTime { get; set; }
        
        /// <summary>The last time the video or its caption were updated</summary>
        [JsonPropertyAttribute("updated_time")]
        public DateTime UpdatedTime { get; set; }
        
        /// <summary>The video title / caption</summary>
        [JsonPropertyAttribute("message")]
        public Object Message { get; set; }
        
        /// <summary>The long-form HTML description of the video</summary>
        [JsonPropertyAttribute("description")]
        public Object Description { get; set; }
        
        /// <summary>The length of the video, in seconds</summary>
        [JsonPropertyAttribute("length")]
        public Object Length { get; set; }
        
        /// <summary>Gets or sets a <see cref="Boolean" /> value representing whether the object has been populated.</summary>
        Boolean IFBGraphResult.IsReady { get; set; }
        
        /// <summary>Updates the current model with values from another like-typed model.</summary>
        /// <param name="other">The source model.</param>
        /// <remarks>This is used for asynchronous calls to update the reference that was returned when the original API method was called.</remarks>
        void IFBGraphResult.UpdateFrom(IFBGraphResult other)
        {
            var that = other as Video;
            if (that == null) return;
            else
            {
                this.Id = that.Id;
                this.From = that.From;
                this.Tags = that.Tags;
                this.Name = that.Name;
                this.Picture = that.Picture;
                this.EmbedHtml = that.EmbedHtml;
                this.Icon = that.Icon;
                this.CreatedTime = that.CreatedTime;
                this.UpdatedTime = that.UpdatedTime;
                this.Message = that.Message;
                this.Description = that.Description;
                this.Length = that.Length;
                ((IFBGraphResult)this).IsReady = true;
            }
            
        }
        
        /// <summary>Contains information about a profile that is tagged in a <see cref="Video" />.</summary>
        public partial class VideoTag
        {
            /// <summary>The Graph API id of the profile that was tagged</summary>
            [JsonPropertyAttribute("id")]
            public Int64 Id { get; set; }
            
            /// <summary>The name of the profile that was tagged</summary>
            [JsonPropertyAttribute("name")]
            public String Name { get; set; }
            
            /// <summary>The date/time that the tag was created</summary>
            [JsonPropertyAttribute("created_time")]
            public DateTime CreatedTime { get; set; }
        }
    }
}